<?php
class folder_type extends Model{
	public static function getTableName(){
		return 'folder_type';
	}

	public function findByObject($object)
	{
		$sql = "
			select a.item_type_id,a.system_label,substr(b.system_label 
			from instr(b.system_label,':')+1) as type 
			from ".self::getTableName()." a,item_type b where a.system_label='".$object."' and b.id=a.item_type_id";
		return Model::$dbo['r']->findBySql(__class__, $sql);
	}

	public static function checkPath($path){
		$sql = 'SELECT id FROM folder_type WHERE path=:path';
		$ret = Model::selectBySql($sql, array(':path'=>$path));
		return isset($ret[0]['id']) ? $ret[0]['id'] : false;
	}

}
